﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ITAP.Core.Modelling.Primitives;
using ITAP.Core.Modelling;


namespace ITAP.ContourBuilder.Components.Dimensions
{
    [Serializable]
    public class ArcRadiusDimension2 : ArcRadiusDimension
    {
        public override void Recalculate()
        {
            if (this.Element == null)
                return;

            if (this.Element.Height != 0)
            {
                Circle elementPrimitive = this.Element.Primitive as Circle;
                ModelPoint pointInArc = elementPrimitive.GetPoint(0.5);
                ModelPoint pointRadius = elementPrimitive.Center.Clone() as ModelPoint;
                this.Primitive = new Line(pointInArc, pointRadius);
            }            
        }

        public override void AcceptDimensionVisitor(IDimensionVisitor visitor)
        {
            visitor.Visit(this);
        }
    }
}
